package com.example.springboot.mapper;

import com.example.springboot.entity.Course_sort;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Course_sortMapper {

    // 查询排课信息
    @Select("SELECT * FROM course_sort")
    List<Course_sort> findAll();
    @Select("SELECT * FROM course_sort where course_id = #{course_id}")   // 根据课程号返回他的课程排课信息
    Course_sort find_msg(Integer course_id);  // 返回字符串  教室号+ 哪节课+ 单双周

    @Insert("insert into course_sort(room_id,course_id,teacher_id,course_time,course_work) " +
            "value" +
            " (#{room_id}," +
            "#{course_id}," +
            "#{teacher_id}," +
            "#{course_time}," +
            "#{course_work})")
    Integer insert(Course_sort course_sort);
    @Select("select  count(*) from course_sort where room_id =#{roomID}")
    Integer roomContNum(Integer roomID);
    @Select("select count(course_id) from  course_sort where room_id=#{roomID} and course_time = #{i} ")
    Integer roomT(Integer roomID, int i);

    @Select("select count(*) from  course_sort where  teacher_id =#{teacher_id} and course_time= #{i}")
    Integer teacherT(Integer teacher_id, int i);
    @Select("select course_time from course_sort where course_id =#{course_id} ")
    List<Course_sort> courseTime(Integer course_id);











}
